# Go 相关变量
GO=go
GO_MODULE=go-frame-lite

# 构建目标
BINARY_NAME=go-frame-lite
BUILD_DIR=bin

.PHONY: all build clean test run

all: build

# 构建应用
build:
	@echo "构建应用..."
	@mkdir -p $(BUILD_DIR)
	@$(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/demo

# 清理构建文件
clean:
	@echo "清理构建文件..."
	@rm -rf $(BUILD_DIR)

# 运行测试
test:
	@echo "运行测试..."
	@$(GO) test ./... -v

# 运行应用
run:
	@echo "启动应用..."
	@$(GO) run ./cmd/demo

# 下载依赖
deps:
	@echo "下载依赖..."
	@$(GO) mod download
	@$(GO) mod tidy

# 格式化代码
fmt:
	@echo "格式化代码..."
	@$(GO) fmt ./...

# 代码检查
lint:
	@echo "代码检查..."
	@$(GO) vet ./...